05. Remotely Connecting to Your Instance
Make a note of the "IPv4 Public IP" address (in the format of “X.X.X.X”) on the EC2 Dashboard.
- Go to your terminal
- Navigate to the location where you stored your .pem file
- For example, if you put your .pem file on your Desktop,
cd ~/Desktop/
will move you to the correct directory.
- For example, if you put your .pem file on your Desktop,
- Type
ssh -i YourKeyName.pem ubuntu@X.X.X.X
X.X.X.X
is the IPv4 Public IP found in AWS.YourKeyName.pem
is the name of your .pem file
Notes: If you see a "bad permissions" or "permission denied" error message regarding your PEM file, try executing chmod 400 path/to/YourKeyName.pem
, then run the ssh command again.
Create and Edit Jupyter Config File
Next you'll need to configure your jupyter notebook settings.
- In your instance, in order to create a config file for your jupyter notebook settings, type in:
jupyter notebook --generate-config
- Change the ip address config setting for notebooks (this is just a fancy one-line command to perform an exact string match replacement; you could do the same thing manually using vi/vim/nano/etc.):
sed -ie "s/#c.NotebookApp.ip = 'localhost'/#c.NotebookApp.ip = '*'/g" ~/.jupyter/jupyter_notebook_config.py
Custom packages
The last step is to install a few packages with pip.
All students should run:
sudo python3 -m pip install tensorflow-gpu==1.1 udacity-pa tqdm
Students planning to complete the VUI concentration should additionally run:
sudo apt-get install libav-tools
sudo python3 -m pip install python_speech_features librosa soundfile
With that done, you're logged into your instance and ready to run the projects! You can run any of the projects in this instance. To make sure everything works, you can test it by running a sample project.
Test the Instance
Make sure everything is working properly by verifying that the instance can run a TensorFlow notebook.
On the EC2 instance
- Clone the deep learning applications module notebooks
git clone https://github.com/udacity/aind2-dl.git
- Enter the repo directory
cd aind2-dl
- Run the notebook
jupyter notebook --ip=0.0.0.0 --no-browser
From your local machine
- You will need the token generated by your jupyter notebook to access it. On your instance terminal, there will be the following line:
Copy/paste this URL into your browser when you connect for the first time, to login with a token:
. Copy everything starting with the:8888/?token=
. - Access the Jupyter notebook index from your web browser by visiting:
X.X.X.X:8888/?token=...
(where X.X.X.X is the IP address of your EC2 instance and everything starting with:8888/?token=
is what you just copied) - Click on the "IMDB_in_Keras_Solutions.ipynb" link to launch the solution notebook
- Run each cell in the notebook
NOTE: Windows users may prefer connecting via the GUI utility PuTTY, by following these instructions.
You're all setup to run all your code on a AWS instance! Once you're done using this instance, stop the instance so you don't run out of credits.
Final Notes
An EC2 AMI instance is an isolated system that already includes all of the libraries required for AIND projects, so you will not need to use the conda environment & package manager, and you can skip the associated section in the project instructions.